
function _getValueMap(options){
    let map={};
    options.forEach((itemObj)=>{
        map[itemObj["value"]]=itemObj["label"];
    })
    return map;
}
export default [
    {id:'name',label:' Schema名称',width:120,value:'',required:true,sortable:true,editorType:'input',show:true,dictionaryValueType:'2'},
    {id:'address',label:' IP地址',width:90,value:'',required:true,sortable:true,editorType:'input',show:true,dictionaryValueType:'2'},
    {id:'port',label:' 端口号',width:90,value:'',required:true,sortable:true,editorType:'input',show:true,dictionaryValueType:'2'},
    {id:'username',label:' 用户名',width:90,value:'',required:true,sortable:true,editorType:'input',show:true,dictionaryValueType:'2'},
    {id:'password',label:' 密码',width:90,value:'',required:true,sortable:true,editorType:'input',show:true,dictionaryValueType:'2'},
    {id:'assignmentStatus',label:'是否已分配',width:120,value:'1',required:true,show:false,sortable:true,editorType:'selectDrop',options:[{
                value: '0',
                label: ' 未分配'
            },{
                value: '1',
                label: '已分配'
            }],
        cellFun:(rowRecord,itemd)=>{
            if((rowRecord[itemd]+"")==="0"){
                return '未分配'
            }else{
                return '已分配';
            }
    }},
]

let _initColWidth=function (cols) {
    let totalWidth=document.body.clientWidth-240-180;
    let colTotalWid=0;
    cols.forEach((item)=>{
        colTotalWid=parseFloat(colTotalWid)+parseFloat(item.width)
    });
    //如果存在多余的宽度，则将多余的宽度平均分配到其他列去
    if(colTotalWid<totalWidth){
        let oWid=totalWidth-colTotalWid;
        let oWidNum=oWid/cols.length;
        cols.forEach((itemObj)=>{
            itemObj["width"]=itemObj["width"]+oWidNum;
        })
    }
}
export {_initColWidth};







let _getCloneCols=function (cols) {
    let newCols=[];
    cols.forEach((itemObj)=>{
        newCols.push({...itemObj});
    })
    return newCols;
}

export {_getCloneCols};